# -*- coding: utf-8 -*-
"""
:mod:`nubio.core.aa`
====================

The ``nubio.core.aa`` module provides classes to represent amino acids, 
protein sequences and their alignments.

"""
from __future__ import (division, with_statement, absolute_import, generators,
                         nested_scopes)
from nubox.char import (Char, CharVector, CharArray)
from nubio.data.alphabet import (AA_IUPAC, GAP_IUPAC)

AA_DUMMY = (ord(GAP_IUPAC[0][0]),)


class Aa(Char):
    """
    A subclass of ``Char`` to represent an amino acid.
    
    The class metadata can contain an ``ALPHABET`` that defines the valid 
    symbols by default ``AA_IUPAC``. See: ``nubio.data.alphabet``.
    
    """

    clsdummy = AA_DUMMY
    clsmeta = (
               ('ALPHABET', AA_IUPAC),
               )


class AaSeq(Aa, CharVector):
    """
    Represents a vector of amino acids.
    
    """
    clschild = Aa


class AaAln(AaSeq, CharArray):
    """
    Represents an alignemnt of amino acids.
    
    """
    clschild = AaSeq


Aa.clsparent = AaSeq
AaSeq.clsparent = AaAln
